Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

random-poly-fill

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

random-poly-fill

A polyfill for crypto.randomFill and crypto.randomFillSync from Node.js core

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
23K
decreased by-14.04%
Maintainers
1
Weekly downloads
 
Created
Source

random-poly-fill

A polyfill for crypto.randomFill and crypto.randomFillSync from Node.js core.

These two functions were added in Node.js v6.13.0. Use this polyfill if you need to use these function in older versions of Node.js.

This polyfill is not optimized for speed or low resource usage. If you can, use crypto.randomBytes directly instead.

npm build status js-standard-style

Installation

npm install random-poly-fill --save

Usage

const { randomFill, randomFillSync } = require('random-poly-fill')

const source = Buffer.alloc(10)

randomFill(source, 0, 5, function (err, target) {
  if (err) throw err
  console.log(source.toString('hex')) // fc4584c64a0000000000
  console.log(target.toString('hex')) // fc4584c64a0000000000
})

const buf = Buffer.alloc(10)

randomFillSync(buf, 5, 5)

console.log(buf.toString('hex')) // 0000000000bcc09d5877

API

crypto.randomFill(buffer[, offset][, size], callback)

See Node.js core documentation for crypto.randomFill.

crypto.randomFillSync(buffer[, offset][, size])

See Node.js core documentation for crypto.randomFillSync.

License

MIT

Keywords

FAQs

Package last updated on 07 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc